//传多个参数
#include <my_head.h>
typedef struct _Msg
{
    char gender;
    int id;
    char name[16];
    short score;
}msg_t;

void *task_func(void *arg){
    #if 1
    msg_t *p = (msg_t *)arg;
    printf("我是子进程 %c %d %s %d\n",p->gender,p->id,p->name,p->score);
    #else
    msg_t num = *(msg_t *)arg;
    printf("我是子进程 %c %d %s %d\n",num.gender,num.id,num.name,num.score);
    #endif
}

int main(int argc, char const *argv[])
{
    msg_t value = {'M',1001,"linan",66};
    pthread_t tid = 0;
    int ret = 0;
    if(0 != (ret = pthread_create(&tid,NULL,task_func,&value))){
        printf("pthread_creat error : [%d] [%s]\n",ret,strerror(ret));
        exit(EXIT_FAILURE);
    }
    printf("我是主线程 %c %d %s %d\n",value.gender,value.id,value.name,value.score);
    sleep(100);
    return 0;
}
